package com.group_g.hkr;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class Panel_Basket implements ActionListener {
	private static JPanel panel;
	private int width;
	private String totalAm;
	private JLabel sum;
	private JButton buyAll = new JButton("Buy all!");
	
	public Panel_Basket() {}

	public JPanel inIt(int width, int height){
		panel = new JPanel();
		panel.setLayout(null);
		panel.setPreferredSize(new Dimension(width,height));
		panel.setBackground(Color.cyan);
		this.width = width;
		buyAll.setBounds(150, height - 50, 100, 30);
		totalAm = "<html>Subtotal:<br />VAT(10% included):<br />_________<br />TOTAL:<html>";
		sum = new JLabel(totalAm);
		sum.setBounds(10, height - 150, 150, 100);
		sum.setFont(new Font("Arial", Font.ITALIC, 16));
		panel.add(sum);
		panel.add(buyAll);
		return panel;
	}
	
	@Override
	public void actionPerformed(ActionEvent e) {
		
	}

	public void resizePanel(int height){
		panel.setPreferredSize(new Dimension(width,height));
		buyAll.setBounds(150, height - 50, 100, 30);
		sum.setBounds(10, height - 150, 150, 100);
	}
	
	public static JPanel getPanel() {
		return panel;
	}

}
